<?php
namespace common\helpers;

class Constants
{

    const TAB_SIZE = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';

    public static function getSortNum()
    {
        return time();
    }

    const YESNO_YES = 1;

    const YESNO_NO = 0;

    public static function getYesNoItems($key = null)
    {
        $items = [
            self::YESNO_YES => '是',
            self::YESNO_NO => '否'
        ];
        return ArrayHelper::getItems($items, $key);
    }

    const STATUS_DELETED = -1;
    
    const STATUS_ENABLE = 1;

    const STATUS_DESABLE = 0;

    public static function getStatusItems($key = null)
    {
        $items = [
            self::STATUS_ENABLE => '已删除',
            self::STATUS_ENABLE => '可用',
            self::STATUS_DESABLE => '禁用'
        ];
        return ArrayHelper::getItems($items, $key);
    }

    const TARGET_SELF = '_self';

    const TARGET_BLANK = '_blank';

    public static function getTargetItems($key = null)
    {
        $items = [
            self::TARGET_SELF => '当前窗口',
            self::TARGET_BLANK => '新窗口'
        ];
        return ArrayHelper::getItems($items, $key);
    }

    const VISIBILITY_PUBLIC = '1';

    const VISIBILITY_HIDDEN = '2';

    const VISIBILITY_PASSWORD = '3';

    const VISIBILITY_PRIVATE = '4';

    public static function getVisibilityItems($key = null)
    {
        $items = [
            self::VISIBILITY_PUBLIC => '公开',
            self::VISIBILITY_HIDDE => '回复可见',
            self::VISIBILITY_PASSWOR => '密码保护',
            self::VISIBILITY_PRIVATEr => '私有'
        ];
        return ArrayHelper::getItems($items, $key);
    }

    const STATUS_PUBLISH = '1';

    const STATUS_DRAFT = '2';

    const STATUS_PENDING = '3';

    public static function getStatusItemsForContent($key = null)
    {
        $items = [
            self::STATUS_PUBLISH => '发布',
            self::STATUS_DRAFT => '草稿',
            self::STATUS_PENDING => '等待审核'
        ];
        return ArrayHelper::getItems($items, $key);
    }

    public static function getRecommendItems($key = null)
    {
        $items = [
            // 0 => '无',
            1 => '一级推荐',
            2 => '二级推荐',
            3 => '三级推荐',
            4 => '四级推荐',
            5 => '五级推荐',
            6 => '六级推荐',
            7 => '七级推荐',
            8 => '八级推荐',
            9 => '九级推荐'
        ];
        return ArrayHelper::getItems($items, $key);
    }

    public static function getHeadlineItems($key = null)
    {
        $items = [
            // 0 => '无',
            1 => '一级头条',
            2 => '二级头条',
            3 => '三级头条',
            4 => '四级头条',
            5 => '五级头条',
            6 => '六级头条',
            7 => '七级头条',
            8 => '八级头条',
            9 => '九级头条'
        ];
        return ArrayHelper::getItems($items, $key);
    }

    public static function getStickyItems($key = null)
    {
        $items = [
            // 0 => '无',
            1 => '一级置顶',
            2 => '二级置顶',
            3 => '三级置顶',
            4 => '四级置顶',
            5 => '五级置顶',
            6 => '六级置顶',
            7 => '七级置顶',
            8 => '八级置顶',
            9 => '九级置顶'
        ];
        
        return ArrayHelper::getItems($items, $key);
    }
}
